var path = require("path")

let gm_config = {};

const ABSOLUTE_PATH_TASSCARD_ENGINE = "/root/tasscard_engine";
const RELATIVE_PATH_TASS_INIT = "tassl/bin/tass_init.sh";
const RELATIVE_PATH_TASS_OPENSSL = "tassl/bin/openssl";
const RELATIVE_PATH_SM2_CLIENT = "cert/client/sm2";
const RELATIVE_PATH_SM2_SERVER = "cert/server/sm2";
const NAME_SETTING_FILE = "setting";
const NAME_GEN_P10_CMD_FILE = "gen_sm2_csr_with_card";
const ABSOLUTE_PATH_NGINX = "/root/nginx";
const RELATIVE_NGINX_CONF = "conf/nginx.conf";
const RELATIVE_NGINX_EXE = "sbin/nginx";
const COMMON_CLIENT_CONF = "client.conf";
const COMMON_SERVER_CONF = "server.conf";
gm_config.DIR_NGINX_CONFS = "/root/nginx/conf/tassl";
gm_config.DIR_NGINX_COMMON_CONFS = "/root/nginx/conf/common";

gm_config.HTTPS_PATH_CERTS = "/home/hhy/ssl/server.crt";
gm_config.HTTPS_PATH_CERTS_KEY = "/home/hhy/ssl/server.key";

gm_config.PATH_TASS_INIT_SH = path.resolve(ABSOLUTE_PATH_TASSCARD_ENGINE, RELATIVE_PATH_TASS_INIT);
gm_config.PATH_SM2_CLIENT = path.resolve(ABSOLUTE_PATH_TASSCARD_ENGINE, RELATIVE_PATH_SM2_CLIENT);
gm_config.PATH_SM2_SERVER = path.resolve(ABSOLUTE_PATH_TASSCARD_ENGINE, RELATIVE_PATH_SM2_SERVER);
gm_config.PATH_TASS_OPENSSL = path.resolve(ABSOLUTE_PATH_TASSCARD_ENGINE, RELATIVE_PATH_TASS_OPENSSL);

gm_config.PATH_CLIENT_SETTING = path.resolve(gm_config.PATH_SM2_CLIENT, NAME_SETTING_FILE);
gm_config.PATH_CLIENT_GEN_SH = path.resolve(gm_config.PATH_SM2_CLIENT, NAME_GEN_P10_CMD_FILE);

gm_config.PATH_SERVER_SETTING = path.resolve(gm_config.PATH_SM2_SERVER, NAME_SETTING_FILE);
gm_config.PATH_SERVER_GEN_SH = path.resolve(gm_config.PATH_SM2_SERVER, NAME_GEN_P10_CMD_FILE);

gm_config.PATH_NGINX_CONF = path.resolve(ABSOLUTE_PATH_NGINX, RELATIVE_NGINX_CONF);
gm_config.PATH_NGINX_EXE = path.resolve(ABSOLUTE_PATH_NGINX, RELATIVE_NGINX_EXE);

gm_config.NGINX_CLIENT_COMMON_CONF = path.resolve(gm_config.DIR_NGINX_COMMON_CONFS, COMMON_CLIENT_CONF);
gm_config.NGINX_SERVER_COMMON_CONF = path.resolve(gm_config.DIR_NGINX_COMMON_CONFS, COMMON_SERVER_CONF);

console.log(gm_config);

module.exports = gm_config;
